//
//  CinemaListTableViewCell.m
//  UI_豆瓣项目
//
//  Created by dllo on 15/11/4.
//  Copyright (c) 2015年 关业达. All rights reserved.
//

#import "CinemaListTableViewCell.h"

@implementation CinemaListTableViewCell

- (void)dealloc
{
    [_nameLabel release];
    [_addressLabel release];
    [_telephoneLabel release];
    [super dealloc];
}

// 重写初始化
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubview];
    }
    return self;
}

- (void)createSubview
{
    UIImageView *imageView1 = [[UIImageView alloc] initWithFrame:CGRectMake(10, 15, 355, 160)];
    [imageView1 setImage:[UIImage imageNamed:@"bg_eventlistcell.png"]];
    [self.contentView addSubview:imageView1];
    [imageView1 release];
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 20, 300, 40)];
//    self.nameLabel.backgroundColor = [UIColor redColor];
    [self.contentView addSubview: self.nameLabel];
    // 字体大小
    self.nameLabel.font = [UIFont systemFontOfSize:20];
    [_nameLabel release];
    
    self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 45, 350, 80)];
//    self.addressLabel.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.addressLabel];
    self.addressLabel.numberOfLines = 0;
    [_addressLabel release];
    
    self.telephoneLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 140, 200, 15)];
//    self.telephoneLabel.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.telephoneLabel];
    [_telephoneLabel release];
    
    
}

// 重写setter方法
- (void)setAcinema:(Cinema *)acinema
{
    if (_acinema != acinema) {
        [_acinema release];
        _acinema = [acinema retain];
    }
    self.nameLabel.text = _acinema.cinemaName;
    self.addressLabel.text = _acinema.address;
    self.telephoneLabel.text = _acinema.telephone;
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
